﻿using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DevKnightlie.WPF.AutoForm.Demo
{
    public enum DepartmentType
    {
        IT,
        HumanResources,
        DesktopSupport,
        Finance
    };

    class AdvancedDataModel : ObservableObject
    {
        #region Private Fields

        private RelayCommand _addStringItemCommand;
        private string _firstName;
        private string _lastName;
        private int _employeeNumber;
        private DepartmentType _department;
        private string _phoneNumber;
        private string _emailAddress;
        private string _newSkill;
        private string _dialogExample;
        private string _notes;

        #endregion

        #region Properties


        public String FirstName
        {
            get { return _firstName; }
            set { Set(() => FirstName, ref _firstName, value); }
        }

        public String LastName
        {
            get { return _lastName; }
            set { Set(() => LastName, ref _lastName, value); }
        }

        public int EmployeeNumber
        {
            get { return _employeeNumber; }
            set { Set(() => EmployeeNumber, ref _employeeNumber, value); }
        }

        public DepartmentType Department
        {
            get { return _department; }
            set { Set(() => Department, ref _department, value); }
        }

        public String PhoneNumber
        {
            get { return _phoneNumber; }
            set { Set(() => PhoneNumber, ref _phoneNumber, value); }
        }

        public String EmailAddress
        {
            get { return _emailAddress; }
            set { Set(() => EmailAddress, ref _emailAddress, value); }
        }

        public String DialogExample
        {
            get { return _dialogExample; }
            set { Set(() => DialogExample, ref _dialogExample, value); }
        }

        public ObservableCollection<String> SkillsList { get; set; }

        public String NewSkill
        {
            get { return _newSkill; }
            set { Set(() => NewSkill, ref _newSkill, value); }
        }

        /// <summary>
        /// This property will be output as a Button conttrol
        /// </summary>
        public RelayCommand AddSkill
        {
            get
            {
                if (_addStringItemCommand == null)
                {
                    _addStringItemCommand = new RelayCommand(() =>
                    {
                        SkillsList.Add(NewSkill);
                        NewSkill = "";
                    });
                }
                return _addStringItemCommand;
            }
        }


        public String Notes
        {
            get { return _notes; }
            set { Set(() => Notes, ref _notes, value); }
        }

        #endregion



        public AdvancedDataModel()
        {
            SkillsList = new ObservableCollection<string>();
        }
    }
}
